home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
1035
/
1035.xpi
/
chrome
/
1clickweather.jar
/
content
/
1clickweather
/
js
/
utils
/
definitions.js
< prev
next >
Wrap
Text File
|
2010-01-05
|
2KB
|
74 lines
// ⌐ 2005 The Weather Channel Interactive, Inc. All Rights Reserved.
Document.prototype.loadXML = function (s) {
// parse the string to a new doc
var doc2 = (new DOMParser()).parseFromString(s, "text/xml");
// remove all initial children
while (this.hasChildNodes())
this.removeChild(this.lastChild);
// insert and import nodes
for (var i = 0; i < doc2.childNodes.length; i++) {
this.appendChild(this.importNode(doc2.childNodes[i], true));
}
};
Document.prototype.__defineGetter__("xml", function () {
return (new XMLSerializer()).serializeToString(this);
});
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};
Function.method('inherits', function (parent) {
var d = {}, p = (this.prototype = new parent());
this.method('uber', function uber(name) {
if (!(name in d)) {
d[name] = 0;
}
var f, r, t = d[name], v = parent.prototype;
if (t) {
while (t) {
v = v.constructor.prototype;
t -= 1;
}
f = v[name];
} else {
f = p[name];
if (f == this[name]) {
f = v[name];
}
}
d[name] += 1;
r = f.apply(this, Array.prototype.slice.apply(arguments, [1]));
d[name] -= 1;
return r;
});
return this;
});
// this is kind of obvious
// Gabriel_Comments: This code does not use localization
DayLookup = {};
DayLookup['Sunday'] = 'Sun';
DayLookup['Monday'] = 'Mon';
DayLookup['Tuesday'] = 'Tue';
DayLookup['Wednesday'] = 'Wed';
DayLookup['Thursday'] = 'Thu';
DayLookup['Friday'] = 'Fri';
DayLookup['Saturday'] = 'Sat';
// this hash associates the value of the position in the userconfig.xml to the xul id in the browser
ToolbarLocations = {};
ToolbarLocations['StatusBar'] = 'status-bar';
ToolbarLocations['ToolBar'] = 'toolbar-menubar';
ToolbarLocations['NavBar'] = 'nav-bar';
ToolbarLocations['PersonalToolbar'] = 'PersonalToolbar';
ToolbarLocations['FindToolbar'] = 'FindToolbar';
ToolbarLocations['MenuBar'] = 'main-menubar';